package com.jingyuan.biz.event.listener;

import com.jingyuan.biz.event.HeartBeatEvent;
import com.jingyuan.biz.manager.JNode;
import com.jingyuan.common.entity.EventType;
import org.springframework.stereotype.Service;

@Service
public class HeartBeatListener extends EventListener<HeartBeatEvent> {
    @Override
    public void actionListener(HeartBeatEvent event) {
        JNode node = event.getNode();
        if(node!=null){
            //重新设置时间，保活
            node.setLastKeepLiveTime(System.currentTimeMillis());
        }
    }

    public HeartBeatListener(){
        setListenEventType(EventType.HEARTBEAT);
    }
}
